ActionController::Routing::Routes.draw do |map|

  map.root :controller => "index"
  
  # User's routes
  map.resources :users
  
  # Program's routes
  map.resources :programs do |program|
    program.datestamped_resources :broadcasts
  end
  
  # Broadcasts routes
  # map.resources :broadcasts
  
  # Audio Assets routes
  #map.resource :audio_assets do |audio_asset|
  #  audio_asset.datestamped_resources :audio_assets do |asset|
  #    asset.resources
  #  end
  #end
  map.resources :audio_assets
  
  # Specialized Routes
  map.tagging 'tagging', :controller => 'index', :action => 'tagging'
  map.manage_users 'manage_users', :controller => 'users', :action => 'manage_users'
  map.contacts 'contacts', :controller => 'informations', :action => 'contacts'
  map.about 'about', :controller => 'informations', :action => 'about'
  
  # Route to tags
  map.connect ':controller/tag/:tag', :action => 'search_tagged'

  # Install the default routes as the lowest priority.
  map.connect ':controller.:format'
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
									 
  # OpenID Authentication
  map.open_id_complete 'session', :controller => "sessions", :action => "create", :requirements => { :method => :get }
  map.resource :session
  
  # Users management
  map.signup '/signup', :controller => 'users', :action => 'new'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.logout '/logout', :controller => 'sessions', :action => 'destroy'
  map.activate '/activate/:id', :controller => 'users', :action => 'activate'
  
  # Routes to RESTful_ACL plugin
  map.error '/error', :controller => 'application', :action => 'error_action'
  map.denied '/denied', :controller => 'application', :action => 'denied_action'
end
